package com.chrray.position.service.web.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chrray.position.auth.Authentication;
import com.chrray.position.auth.AuthenticationContext;
import com.chrray.position.domain.FdFeedback;
import com.chrray.position.domain.dto.FdFeedbackDTO;
import com.chrray.position.domain.dto.search.FdFeedbackSearch;
import com.chrray.position.domain.vo.FdFeedbackVO;
import com.chrray.position.enums.YesNoEnum;
import com.chrray.position.exception.ServiceException;
import com.chrray.position.mapper.position.FdFeedbackMapper;
import com.chrray.position.pojo.dto.web.FdFeedBackExe;
import com.chrray.position.service.position.FdFeedbackService;
import com.chrray.position.service.web.WFdFeedbackService;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 意见反馈表 接口实现类
 *
 * @author wusiwee
 * @email wusiwee@163.com
 * @since 1.0.1 2024-08-07
 */
@Service
@AllArgsConstructor
public class WFdFeedbackServiceImpl extends ServiceImpl<FdFeedbackMapper, FdFeedback> implements WFdFeedbackService {


    @Override
    public IPage pageList(FdFeedBackExe entity) {
        LambdaQueryWrapper<FdFeedback> queryWrapper = new LambdaQueryWrapper<>();

        queryWrapper.eq(!ObjectUtils.isEmpty(entity.getUserName()), FdFeedback::getUserName, entity.getUserName());
        queryWrapper.orderByDesc(FdFeedback::getFeedbackTime);
        IPage page = entity.getPage();
        IPage<FdFeedback> pageList = this.page(page, queryWrapper);
        return  pageList;
    }
}
